package com.co.file.service.impl;

import com.co.file.mapper.VedioDetailMapper;
import com.co.file.mapper.VideoMapper;
import com.co.file.mapper.VideoStateMapper;
import com.co.file.service.VedioSaveService;
import com.co.video.pojo.Detail;
import com.co.video.pojo.Video;
import com.co.video.pojo.VideoState;
import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class VedioSaveServiceImpl implements VedioSaveService {


    @Autowired
    private VedioDetailMapper vedioDetailMapper;

    @Autowired
    private VideoStateMapper videoStateMapper;

    @Autowired
    private VideoMapper videoMapper;

    @Override
    public void save2Detail(Detail vedioDetail) {
        //把数据什么的全部都保存进入数据库中
        vedioDetailMapper.insertSelective(vedioDetail);
    }

    @Override
    public void save2State(VideoState videoState) {
        videoStateMapper.insertSelective(videoState);
    }

    @Override
    public void save2Video(Video video) {
        videoMapper.insertSelective(video);
    }

    /**
     * 根据aid查出当前的视频实体类
     * @param aid
     * @return
     */
    @Override
    public Detail find(String aid) {
        return vedioDetailMapper.selectByPrimaryKey(aid);
    }
}
